package org.gpp.proj1.ui;

import org.gpp.proj1.logic.ISRGUIModel;
import org.gpp.proj1.logic.SRGUIModelImpl;
import org.gpp.proj1.ui.controller.ISRGUIController;
import org.gpp.proj1.ui.controller.SRGUIControllerImpl;
import org.gpp.proj1.ui.gui.SRGGUIView;

/**
 * Class that launches the game
 * 
 * @author Paolo Victor, paolovictor@gmail.com
 */
public class SRGLauncher {
	public static final String DEFAULT_PROFILES_PATH = "profiles";
	
	private ISRGUIController controller;
	private ISRGUIModel model;
	private ISRGUIView view;

	public SRGLauncher() {
		this.model = new SRGUIModelImpl( DEFAULT_PROFILES_PATH );
		this.view = new SRGGUIView();
		
		this.controller = new SRGUIControllerImpl( model );
		this.controller.registerView( view );
		
		this.model.setController( controller );
		this.view.setController( controller );
		
//		LoggingSystem.getLoggingSystem().loggerOn( false );
	}

	
	public SRGLauncher( String profilesFile ) {
		
		this.model = new SRGUIModelImpl( profilesFile );		
	}

	public static void main(String[] args) {
		// The first parameter is the profiles file path
		if( args.length > 0 ) {
			new SRGLauncher( args[1] ).start();	
		} else {
			new SRGLauncher().start();
		}		
	}

	private void start() {
		
		this.model.start();		
	}
}
